<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<style>
    td, th {
        height: 34.29px !important;
    }

    .familyMemberDialog .modal-dialog {
        width: 60%;
    }

    input {
        height: 30px !important;
    }

    .editFormDiv label {
        margin: 0 auto !important;
    }

    .editFormDiv .control-label {
        text-align: right;
        line-height: 25px;
    }
</style>
<div class="row" style="margin-left: 0px!important;">
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="margin-top: 15px">
        <div class="widget flat radius-bordered"
             style="margin-top: 0;box-shadow:0px 0px 10px rgba(122,161,184,0.3);!important;">
            <div class="widget-body no-padding">
                <div class="table-scrollable">
                    <!-- 数据表列信息列表 -->
                    <table class="table table-bordered dataTable">
                        <thead>
                        <tr>
                            <th class="col-xs-4" title="费用类型">费用类型</th>
                            <th class="col-xs-4" title="费用金额">费用金额</th>
                            <th class="col-xs-4" title="缴费时间">缴费时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>${(data.paymentType???string(data.paymentType?html,"未设置"))!'未设置'}</td>
                            <td>${(data.amount???string(data.amount?html,"未设置"))!'未设置'}</td>
                            <td>${(data.createTime???string(data.createTime?html,"未设置"))!'未设置'}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <form class="editForm editFormDiv" action="${saveUrl}" method="post" responseType="JSON" role="form"
              id="editForm_${serializeNum}"          data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"
              data-bv-message="This value is not valid"
              data-bv-feedbackicons-valid="glyphicon glyphicon-ok"
              data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"
              data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">
            <!--<input type="hidden" name="paymentId" value="${data.id}">-->
            <input type="hidden" id="stuId" name="stuId" value="${stuId}">
            <input type="hidden" id="paymentId" name="paymentId" value="${data.id}">
            <input type="hidden" id="paymentType" name="paymentType" value="${data.paymentType}">
            <input type="hidden" id="refundType" name="refundType" value="${data.paymentType}">
            <input type="hidden" id="amount" name="amount" value="${data.amount}">
            <div>
                <div class="col-xs-6 col-sm-6 col-lg-12" style="margin-bottom: 20px">
                    <div class="col-xs-6 nopadding-left">
                        <div class="form-group">
                            <label for="amout" title="默认退费金额=课时包金额-（正课课时数-退课课时数）*原单价"
                                   class="col-xs-2 control-label no-padding-right no-padding-left"><span style="color: red">*</span>退费金额：</label>
                            <label class="col-xs-6 no-padding-right no-padding-left">
                                <input data-bv-integer-message="The field is number"
                                       data-bv-message="The field is not valid"
                                       data-bv-integer="true" size="11" name="amout" id="amout" alt="退费金额"
                                       placeholder="退费金额" onblur="prompt(this)"
                                       type="text" title="退费金额" class="form-control col-xs-12" value="${editEntity.amount}"/>
                                <span class="text"></span>
                            </label>
                            <label style="line-height: 30px!important;padding-left: 5px">元</label>
                        </div>
                    </div>
                </div>

                <div class="col-xs-6 col-sm-6 col-lg-12" style="margin-bottom: 20px">
                    <div class="col-xs-6 nopadding-left">
                        <div class="form-group">
                            <label for="amout" title="默认退费金额=课时包金额-（正课课时数-退课课时数）*原单价"
                                   class="col-xs-2 control-label no-padding-right no-padding-left"><span style="color: red">*</span>退费备注：</label>
                            <label class="col-xs-10 no-padding-right no-padding-left">
                               <textarea class="form-control" name="remark" size="500" rows="3" style="resize:none" id="remark"
                                         value="${editEntity.remark}"></textarea>
                            </label>
                        </div>
                    </div>
                </div>
                <div class="col-xs-12 margin-bottom-10">
                    <div class="text-align-center">
                        <button style="width: 80px;margin-right: 20px" type="button" class="btn btn-blue" id="depositEditFormSubmitBtn_${serializeNum}" onclick="Refund()">提交</button>
                        <input style="width: 80px" type="button" class="btn btn-blue" data-dismiss="modal" value="取消" onclick="backView()"/>
                    </div>
                </div>
            </div>
        </form>
    </div>

</div>
<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>
    function prompt(that){
        var amout = $(that).val();
        var amount = $('.amount').val();
        console.log("amout"+amout);
        console.log("amount"+amount);
        if(amout > amount){
            alert("请输入正确的退费金额");
        }

    }

    /**
     * 提交
     * @param that
     * @constructor
     */
    function Refund() {
        var stuId = $("#stuId").val();
        var refundType = $("#refundType").val();
        var amout = $("#amout").val();
        var remark = $("#remark").val();
        var paymentId = $("#paymentId").val();
        ajaxRequest("tssMemberReturnPremiumController/saveOrUpdate.do", {
            stuId:stuId,
            refundType:refundType,
            amout:amout,
            remark:remark,
            paymentId:paymentId
        }, function (data) {
            alert("提交成功");
            if (data.resCode == "200") {

            }
            alert(data.resMsg)
        }, function () {
            ajaxError("加载页面失败!")
        }, "post", "json")

    }


</script>